package com.daka.vo.response.user;

import com.daka.entity.Organization;
import com.daka.entity.User;
import lombok.Data;
import lombok.ToString;

import java.sql.Timestamp;

/**
 * @author beliveli on 2016/5/19
 */
@Data
@ToString
public class UserDetailVo {
    private int userId;
    private String userName;
    private String phone;
    private String password;
    private int certificateType;
    private String certificateCode;
    private int orgId;
    private Organization organization;
    private String image;
    private int status;
    private int role;
    private Timestamp createTime;

    public static UserDetailVo build(User user, Organization organization) {

        UserDetailVo userDetailVo = new UserDetailVo();

        userDetailVo.setUserId(user.getUserId());
        userDetailVo.setUserName(user.getUserName());
        userDetailVo.setPhone(user.getPhone());
        userDetailVo.setPassword(user.getPassword());
        userDetailVo.setCertificateCode(user.getCertificateCode());
        userDetailVo.setCertificateType(user.getCertificateType());
        userDetailVo.setOrgId(user.getOrgId());
        userDetailVo.setOrganization(organization);
        userDetailVo.setImage(user.getImage());
        userDetailVo.setStatus(user.getStatus());
        userDetailVo.setCreateTime(user.getCreateTime());
        userDetailVo.setRole(user.getRole());

        return userDetailVo;
    }
}
